package com.lsh;

import com.lsh.entity.Monitor;
import com.lsh.repository.MonitorRepository;
import com.lsh.service.Impl.WXServiceImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

/**
 * @author ：LiuShihao
 * @date ：Created in 2020/10/18 4:10 下午
 * @desc ：
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class DemoTest1 {
    @Autowired
    MonitorRepository monitorRepository;
    @Autowired
    WXServiceImpl wxService;
    // 凭证获取（GET）
    public final static String token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
    private static String appId = "wx4959a20a2a31b3fc";
    private static String appsecret = "d0e97bd7be270bc400734e385eb1ad0e";
    @Test
    public void test1(){
        List<Monitor> monitors = monitorRepository.findByStart_timeAfter8AndEnd_timeBefore24AndFlagIsNot1();
        System.out.println(monitors);

    }

    /**
     * HTTP/1.1 200
     * HTTP/1.1 404
     */
    @Test
    public void test2(){
        String str = "HTTP/1.1 200 OK";
        String substring = str.substring(9,12);
        System.out.println(substring);
//        HttpClient.doGet("http://wangyitong.club/wx/findAllUserq");
    }
    //38_xKFlS_0Ugr3WQ5R90LX2Cr3A2EMj2ck89VTcIF2TeBIqnVuOyDUp3vtjqfoQe_bTP3nqHy8SvVQYpHMSrr9xMiyTylMPUZ8LR2RpY0Ouwc7TW0Q9W6vDcHwAV-pUw2-WKRcoQMawHIbgMjJfKEMgADAUOW
    @Test()
    public void test3(){
//        String requestUrl = token_url.replace("APPID", appId).replace("APPSECRET", appsecret);
//        HttpClient.doGet(requestUrl);
        wxService.sendWXMessage("微信公众号"+"："+"http://www.wangyitong.club/wx/findAllUser/","2020年10月18日18:29:23");
    }
    @Test()
    public void test4(){
        wxService.sendWXMessage("微信公众号"+"："+"http://www.wangyitong.club/wx/findAllUser/","2020年10月18日18:29:23");
    }
}
